package com.sen.rbac.feign;

import com.sen.common.common.bo.SysAccountBO;
import com.sen.common.common.response.MessageResult;
import com.sen.common.common.response.PageVo;
import com.sen.rbac.dto.SysAccountDto;
import com.sen.rbac.feign.fallback.RbacAccountFeignFallbackFactory;
import com.sen.rbac.vo.SysAccountVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author esjiang
 */
@FeignClient(name = "linsir-sen-rbac",fallbackFactory = RbacAccountFeignFallbackFactory.class)
public interface RbacAccountFeign {

    /**
     * 根据账户名查询账户信息
     * @param userName
     * @param tenantCode
     * @param systemCode
     * @return
     */
    @GetMapping("/account/selectAccountByUserNameForGateway")
    MessageResult<SysAccountBO> selectAccountByUserNameForGateway(@RequestParam("userName") String userName,
                                                                  @RequestParam("tenantCode") String tenantCode,
                                                                  @RequestParam("systemCode") String systemCode);

    /**
     * 新增账户
     * @param accountDto
     * @return
     */
    @PostMapping("/account/add")
    MessageResult add(@RequestBody SysAccountDto accountDto) ;

    /**
     * 检查账户名唯一性
     * @param userName
     * @return
     */
    @GetMapping("/account/checkUniqueAccount")
    MessageResult checkUniqueAccount(@RequestParam("userName") String userName) ;

    /**
     * 删除账户
     * @param userName
     * @return
     */
    @GetMapping("/account/del")
    MessageResult delete(@RequestParam("userName") String userName) ;


    /**
     * 所有账户信息
     * @param accountDto
     * @return
     */
    @GetMapping("/account/list")
    MessageResult<PageVo<SysAccountVO>> list(@RequestBody SysAccountDto accountDto) ;

    /**
     * 根据账户名获取庄户
     * @param
     * @return
     */
    @GetMapping("/account/selectAccountByUserName")
    MessageResult<SysAccountBO> selectAccountByUserName(@RequestParam("userName") String userName);

}
